<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间修饰符</title>
    <script src="js/vue.js"></script>
    <style>
        #cc {
            width: 100px;
            height: 100px;
            background-color: red;
        }

        #cc1 {
            width: 50px;
            height: 50px;
            background-color: blue;
        }

        #cc2 {
            width: 50px;
            height: 50px;
            background-color: yellow;
        }

        #cc3 {
            width: 30px;
            height: 30px;
            background-color: green;
        }
    </style>
</head>

<body>
    <div id="app">
        <div id="cc" @click="cclick">
            <!-- .stop 阻止事件冒泡 -->
            <div id="cc1" @click.stop="cc1click"></div>
            <!-- .self 只触发标签自己的事件 -->
            <div id="cc2" @click.self="ccc2click">
                <div id="cc3"></div>
            </div>
        </div>
        <!-- .prevent 阻止默认行为-->
        <a href="https:/www.baidu.com" @click.prevent="aclick">跳转到自定义页面</a>
        <!-- .once 只触发一次 -->
        <button @click.once="cclick">点击</button>
        <!-- 键盘事件修饰符 回车 -->
        <input type="text" @keyup.enter.tab="keyupEnter" placeholder="回车被点击了"></input>
        <!-- 键盘事件修饰符 tab -->
        <input type="text" @keyup.tab="keyupTab" placeholder="tab被点击了"></input>

    </div>
</body>

</html>
<script>
    new Vue({
        el: '#app',
        data: {
            msg: ''
        },
        methods: {
            keyupTab() {
                alert('tab被点击了')
            },
            keyupEnter() {
                alert('回车被点击了')
            },
            ccc2click() {
                alert('cc2被点击了')
            },
            aclick() {
                alert('a标签被点击了')
            },
            cc1click() {
                alert('cc1被点击了')
            },
            cclick() {
                alert('cc被点击了')
            }
        }
    })
</script>